var projectID = GetQueryString("id");
var sentMessage = {
    "requestType": "initBaseData",
    "pj_id": projectID
};
var postData;
$.ajax({
    url: '/pj/checkDepute',
    type: 'post',
    data: sentMessage,
    async: false,
    success: function (data, status) {
        if (status == 'success') {
            postData = data;
            console.log(data)
            // window.location.href = '/projectManage.html';
        }

    },
    error: function (data, status) {
        if (status == 'error') {
            alert("你的网络有问题！");
        }
    }
});
//显示基本信息
var basicInfomation = document.getElementById("basicInfomation").children[0];
var basicInfomationData = [
    ["委托单位", "委托人", "开始时间", "结束时间", "状态", "地址", "描述"],
    []];
var date1 = new Date(postData[0].pj_start);
postData[0].pj_start=date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate();
date1.getDate();
var date2 = new Date(postData[0].pj_fin);
postData[0].pj_fin = date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate();
date2.getDate();
basicInfomationData[1] = [
    postData[0].pj_company,
    postData[0].user_name,
    postData[0].pj_start,
    postData[0].pj_fin,
    postData[0].pj_state,
    postData[0].pj_addr,
    postData[0].pj_description
];
for (let i = 0; i < basicInfomationData[0].length; i++) {
    let tr = document.createElement("tr");
    if (i % 2 === 0) {
        basicInfomation.appendChild(tr);
    }
    let td = document.createElement("td");
    td.setAttribute("class", "td-shadows");
    td.setAttribute("align", "center");
    td.innerHTML = basicInfomationData[0][i];
    basicInfomation.children[basicInfomation.childElementCount - 1].appendChild(td);
    td = document.createElement("td");
    td.setAttribute("align", "center");
    td.innerHTML = basicInfomationData[1][i];
    basicInfomation.children[basicInfomation.childElementCount - 1].appendChild(td);
}
